<template>
	<view>
		<u-action-sheet :actions="list" :closeOnClickOverlay="true" @select="selectClick" :closeOnClickAction="true" :show="show"></u-action-sheet>
		<u-button @click="show = true">打开ActionSheet</u-button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			list: [
				{
					name: '拍摄',
					color: '#137add',
					fontSize: '20'
				},
				{
					name: '从相册选择',
					color: '#137add',
					fontSize: '20'
				},
				{
					name: '取消',
					color: '#137add',
					fontSize: '20'
				}
			],
			show: false,
		};
	},
	onLoad() {
	},
	methods: {
		selectClick(index) {
			console.log(index.name);
			const str = index.name;
			this.onQuit(str);
			this.onSelect(str)
		},

		onQuit(str) {
			if (str === '取消') {
				
				this.show = false; // 在取消后关闭当前弹窗
			}
		},
		
		onSelect(str) {
			if(str==='从相册选择'){
				uni.navigateTo({
					url:'/pages/video/video'
				})
				this.show = false;
			}
		}
	}
};
</script>
